/**
 * Created by WangMing on 15/12/9.
 */
define(["../../service",
    "../../widgets/live_table_widget/live_table_widget"

], function(api) {
    // 定义所有相关的vmodel
    var vm = avalon.define({
        $id: "onlines",
        $breadcrumb: {
            stateName: "onlines",
            guid: "",
            title: null // translation later in routers
        },

        results: {
            // pager : {
            //   perPages: 8
            // },

            noCategory: true,
            params: {
                method: api.getOnlines,
                query: {
                    PageSize:6
                }
            }
        },
        displayPage: function(state) {
            return state.vmName == "onlines";
        }
    });

    return avalon.controller(function($ctrl) {
        // 视图渲染后，意思是avalon.scan完成
        $ctrl.$onRendered = function() {
            
            setInterval(function() {
                // console.log("mum say refresh");
                vm.$fire("down!refresh");
                vm.$fire("down!onlineRefresh")
            }, 10000)

        };
        // 进入视图
        $ctrl.$onEnter = function(param, rs, rj) {

        };
        // 对应的视图销毁前
        $ctrl.$onBeforeUnload = function() {

        };
        $ctrl.$vmodels = [vm]; 
    })
}); 
